import {post, get, postForm} from "../util/http";
import {JobUserVO, PageQueryUserParam, UpdateUserParam, UserLoginVO} from "../model/User";
import {PageQuery, PageResult} from "../model/Common";
export default {
    login(data: string): Promise<UserLoginVO> {
        return post<UserLoginVO>("/user/login", {"param": data});
    },
    getCaptcha(): Promise<UserLoginVO> {
        return get<UserLoginVO>("/user/getCaptcha");
    },
    getPublicKey(): Promise<string> {
        return get<string>("/user/getPublicKey");
    },
    addUser(data: string): Promise<string> {
        return post<string>("/user/addUser", {"param": data});
    },
    changeUser(id: bigint, enabled: boolean): Promise<string> {
        return postForm<string>("/user/changeUser", {id, enabled})
    },
    updateUser(data: UpdateUserParam): Promise<string> {
        return post<string>("/user/updateUser", data);
    },
    pageList(data: PageQuery<PageQueryUserParam>): Promise<PageResult<JobUserVO>> {
        return post<PageResult<JobUserVO>>("/user/pageList", data);
    }
}
